<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Mini-Web 帐号管理</title>
	<%@ include file="/common/meta.jsp"%>
	<link href="${ctx}/css/default.css" type="text/css" rel="stylesheet" />
	<link href="${ctx}/js/validate/jquery.validate.css" type="text/css" rel="stylesheet" />
	<script src="${ctx}/js/jquery.js" type="text/javascript"></script>
	<script src="${ctx}/js/validate/jquery.validate.js" type="text/javascript"></script>
	<script src="${ctx}/js/validate/messages_cn.js" type="text/javascript"></script>
	<script>
		var treeUrl = "${ctx}/security/dept!deptTree.action";
		$(document).ready(function(){
			//聚焦第一个输入框
			$("#loginName").focus();
			//为inputForm注册validate函数
			$("#inputForm").validate({
				rules: { 
					code: { 
        				required: true, 
        				remote: "user!checkLoginName.action?orgLoginName="+encodeURIComponent('${code}')
    			},
          name: "required",
          password: {
    					required: true,
    					minlength:3
    			}, 
    			passwordConfirm: {
    					equalTo:"#password"
    			},
    			email:"email"
				},
				messages: {
					code: {
						remote: "用户登录名已存在"
					},
					passwordConfirm: {
						equalTo: "输入与上面相同的密码"
					}
				}
			});
			$("#preview").hide();
			$("#deptName").click(function(e){
				$("#preview").show().css("top",(e.pageY - 10) + "px").css("left",(e.pageX + 10) + "px");
			});
		});

		function showDetail(id,title){
			$("#deptId").val(id);
			$("#deptName").val(title);
			$("#preview").hide();
		}

	</script>
</head>

<body>
<style type="text/css">
#preview{
	position:absolute;
	border:1px solid #ccc;
	background:#f7f5d1;
	padding:5px;
	display:none;
	color:#fff;
	overflow:auto;
	width:200px;
	height:200px;
}
.close{
	font-size:14px;
	line-height:14px;
	right:6px;
	top:4px;
	position:absolute;
	color:#6fa5fd;
	display:block;
	cursor:pointer;
}
</style>
		<link type="text/css" rel="stylesheet" href="${ctx}/css/xtree.css" />
		<script type="text/javascript" language="javascript1.2" src="${ctx}/js/xtree.js"></script>
		<div id="preview">
		<a onclick="closePreview();" class="close">x</a>
		<script language="javascript1.2">
			function closePreview(){
				$("#preview").hide();
			}
			function getDT(){	
				var DT1 = new Date();
				return (DT1.getYear()+''+DT1.getMonth()+''+DT1.getDate() +''+ DT1.getTime()); 
			}
			var atree;
			<!--单选-->
			atree = new WebFXLoadTree("主目录",treeUrl,false,false,"javascript:showDetail('1','主目录');");
			document.write(atree);
		</script>
		</div>
<h3><s:if test="id == null">创建</s:if><s:else>修改</s:else>用户</h3>
<div id="inputContent">
<form id="inputForm" action="user!save.action" method="post">
<input type="hidden" name="id" value="${id}" />
<table class="inputView">
	<tr>
		<td>登录名:</td>
		<td><input type="text" name="code" size="40" id="code" value="${code}" /></td>
	</tr>
	<tr>
		<td>用户名:</td>
		<td><input type="text" name="name" size="40" value="${name}" /></td>
	</tr>
	<tr>
		<td>密码:</td>
		<td><input type="password" id="password" name="password" size="40" value="${password}" /></td>
	</tr>
	<tr>
		<td>确认密码:</td>
		<td><input type="password" name="passwordConfirm" size="40" value="${password}" /></td>
	</tr>
	<tr>
		<td>邮箱:</td>
		<td><input type="text" name="email" size="40" value="${email}" /></td>
	</tr>
	<tr>
		<td>部门:</td>
		<td>
			<input type="hidden" name='dept.id' id="deptId" value="${dept.id}"/>
			<input type="text" name="dept.name" id="deptName" size="40" value="${dept.name}" />
		</td>
	</tr>
	<tr>
		<td>顺序:</td>
		<td><input type="text" name="orderNum" size="40" value="${orderNum}" /></td>
	</tr>
	<tr>
		<td>角色:</td>
		<td>
			<div style="word-break:break-all;width:500px;height:30px overflow:auto; ">
				<s:checkboxlist name="checkedAuthorityIds"  list="allAuthorities"  listKey="id" listValue="displayName" theme="simple"/>
			</div>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<input type="submit" value="提交" />&nbsp; 
			<input type="button" value="取消" onclick="history.back()"/>
		</td>
	</tr>
</table>
</form>
</div>
</body>
</html>